---
import TableOfContentsList from '../../../node_modules/@astrojs/starlight/components/TableOfContents/TableOfContentsList.astro';
import TutorialNav from '../tutorial/TutorialNav.astro';

const { entry, toc } = Astro.locals.starlightRoute;

const isTutorial = entry.id.split('/')[1] === 'tutorial';
---

{
	toc && (
		<starlight-toc data-min-h={toc.minHeadingLevel} data-max-h={toc.maxHeadingLevel}>
			<nav aria-labelledby="starlight__on-this-page">
				<h2 id="starlight__on-this-page">
					{isTutorial
						? Astro.locals.t('tutorial.trackerLabel')
						: Astro.locals.t('tableOfContents.onThisPage')}
				</h2>
				{isTutorial ? <TutorialNav /> : <TableOfContentsList toc={toc.items} />}
			</nav>
		</starlight-toc>
	)
}

<script src="../../../node_modules/@astrojs/starlight/components/TableOfContents/starlight-toc"
></script>
